<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src ="routines.js"></script>

<video id="video1" autoplay></video>

<script>
promise_test(async (test) => {
  const {sender, receiver, senderPc, receiverPc} = await createConnectionWithTransform(test, 'RTCRtpScriptTransform-bad-chunk-worker.js', {audio: true});

  assert_array_equals(await getNextMessage(sender.transform.port), ["TypeError", "null"]);
  assert_array_equals(await getNextMessage(sender.transform.port), ["TypeError", "RTCEncodedAudioFrame"]);
}, "Writing bad chunks should error the stream");
</script>
